-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-46921: Vectorcall support for super()
#31687
Conversation
Co-Authored-By: Dong-hee Na <donghee.na@python.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current PR does not check the number of arguments.
Please add the unit test for this also :)
AS-IS
>>> super(int, int, int)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: super() takes at most 2 arguments (3 given)
PR
>>> super(int, int, int)
<super: <class 'int'>, NULL>
When you're done making the requested changes, leave the comment: |
See my benchmark: https://bugs.python.org/msg414577 |
Co-Authored-By: Dong-hee Na <donghee.na@python.org>
@corona10 thanks for taking the time to benchmark this and for the extremely useful suggestions too. I forgot all the cool argument checking helpers we have since I'm a little rusty. If you're interested, there's the monster GH-30992 too where I measured >2X speedup. But it's very complex and I don't have high hopes for it being merged. |
I wonder how much a free list would help? I'd bet super objects typically have short lifetimes and not many are alive at once. |
As I wrote, please add the test for checking TypeError when the given number of arguments are greater equal than 3 :) |
🤦 my bad, I missed that. Thanks again. I added one more test since I noticed it wasn't covered in the test suite. |
There will probably be some improvement versus relying on CPython's obmalloc "free list". My final goal is to not need any super object at all though :). BTW, are you able to guesstimate how much more complexity we need for a super free list? If it isn't too complex, it's likely more worth it than my cached superinstruction overkill implementation. |
I think it's (relatively) straightforward, see floatobject.c for an example. The actual free list gets attached to _PyInterpreterState there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Feel free to merge this PR :)
@corona10 thanks for the reviews! |
Benchmarks todo.
https://bugs.python.org/issue46921